<?php
namespace Base\Exception
{
    class RmException extends \Exception
    {
        public function __toString()
        {
            $error = array();

            $debug = array_shift(self::getTrace());
            $args = "";
            if(empty($debug['args']) == false)
            {
                ob_start();
                print_r($debug['args']);
                $args = ob_get_contents();
                ob_end_clean();
            }

            array_push($error, "");
            array_push($error, "[FILE] ".$debug['file']);
            array_push($error, "[LINE] ".$debug['line']);
            array_push($error, "[CLASS] ".$debug['class']);
            array_push($error, "[FUNCTION] ".$debug['function']);
            array_push($error, "[ARGS] ". $args);
            array_push($error, "[CODE] ".$this->getCode());
            array_push($error, "[MESSAGE] ".$this->getMessage());
            array_push($error, "");
            return implode("\n", $error);
        }
    }
}